package com.ssl.replation.controller;

import com.ssl.replation.model.User;
import com.ssl.replation.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 描述：
 *
 * @author ssl
 * @create 2021/7/23 0023.
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;


    @GetMapping("create")
    public Map<String, Object> create(String name) {
        userService.create(name);
        Map<String, Object> map = new HashMap<>();
        map.put("code", "0000");
        map.put("message", "插入成功。");
        return map;
    }

    @GetMapping("get")
    public User get(String name) {
        return userService.get(name);
    }
}
